package cn.itcast.n3_Java线程;

import lombok.extern.slf4j.Slf4j;

/**
 * @program: juc
 * @description:
 * @author: flyduck
 * @create: 2024-08-29 16:59
 **/
@Slf4j(topic = "c.Test24_主线程和守护线程_java进程等所有非守护线程运行完毕才会停止")
public class Test24_主线程和守护线程_java进程等所有非守护线程运行完毕才会停止 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            while (true) {
                if (Thread.currentThread().isInterrupted()) {
                    break;
                }
            }
            log.debug("结束");
        },"t1");
        t1.setDaemon(true);
        t1.start();

        Thread.sleep(1000);
        log.debug("结束");
    }
}
